﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;

namespace Pixster.Slideshow
{
    [TemplatePart(Name = "PART_Image", Type = typeof(Image))]
    public class PhotoHost : PhotoHostBase
    {
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _image = this.GetTemplateChild("PART_Image") as Image;
            if (_image != null) _image.Source = new BitmapImage(this.Photo.WebUri);
        }

        protected override void DoUpdateContent()
        {
            if (this._image == null)
                return;

            this._image.Source = new BitmapImage(this.Photo.WebUri);
        }
    }
}